<template>
    <div class="right-bottom">
        <div class="nomessage" v-if="infoList.length == 0">
            <img class="noneimg" src="../../../../../public/1.png" alt="" />
            <text>无更多数据</text>
        </div>
        <div class="training-item" v-for="item in infoList" :key="item.id" v-else>
            <div class="content" @click="toDetail(item)">
                <div class="cover"><img class="img" :src="item.cover" /></div>

                <div class="infomation">
                    <div class="title">{{ item.planName }}</div>
                    <div class="times">已练习0次0分钟</div>
                </div>
                <div class="status">
                    <el-icon><Clock /></el-icon>
                    <div>未开始</div>
                </div>
            </div>
        </div>
    </div>
</template>

<script setup lang="ts">
import mockApi from '@/api/mockApi';
import { onMounted, ref, watch } from 'vue';
// import wmqApi from '@/api/wmqApi';
import { useRouter } from 'vue-router';
const router = useRouter();
const props = defineProps(['course']);
let infoList = ref<any>('');
const getClassInfo = async () => {
    try {
        infoList.value = '';
        let result = await mockApi.getMineInfo(props.course);
        infoList.value = result.data.content;
    } catch (error) {}
};
const toDetail = (item: any) => {
    router.push(`/detail/training?id=${item.id}`);
};
watch(
    () => props.course,
    () => {
        getClassInfo();
    },
    {
        immediate: true,
    }
);
</script>

<style scoped>
.right-bottom {
    height: 700px;
    background-color: #fff;
    border-radius: 4px;
    margin-top: 10px;
    position: relative;
    /* display: flex; */
    /* justify-content: center;
    align-items: center; */
    padding-top: 20px;
}
.training-item {
    height: 142px;
    width: 100%;
    margin-left: 30px;
}
.content {
    height: 101px;
    padding: 20px 0;
    display: flex;
    position: relative;
    border-bottom: 1px solid #e3e3e3;
}
.cover {
    width: 169px;
    height: 101px;
    border-radius: 4px;
    background-size: cover;
    background-position: 50%;
    margin-right: 20px;
    display: block;
}
.img {
    width: 169px;
    height: 101px;
}
.infomation {
    display: block;
    width: 101px;
}
.times {
    margin-top: 25px;
    font-size: 14px;
    color: #7d8090;
}
.status {
    text-align: center;
    float: right;
    position: absolute;
    top: 43px;
    right: 130px;
    width: 48px;
}
.el-icon {
    width: 22px;
    height: 22px;
    vertical-align: -0.15em;
    fill: currentColor;
    color: rgb(255, 166, 202);
}
.status > div {
    margin-top: 5px;
    color: #7d8090;
}
.nomessage {
    width: 225px;
    height: 260px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    text-align: center;
    color: rgb(177, 181, 193);
    position: absolute;
    top: 150px;
    left: 390px;
}
.noneimg {
    margin-bottom: 20px;
}
</style>
